#coding:utf8

'''
TopAPI配置文件
'''

#API中涉及到的表中主键关系映射
mapping={
	#类目API
	'SellerAuthorize':[{'pk':'sid','type':'session'}],
	'ItemCat':[{'pk':'cid','type':'self'}],
	'Brand':[{'pk':'vid','type':'self'}],
	'ItemProp':[{'pk':'pid','type':'self'}],
	'PropValue':[{'pk':'vid','type':'self'}],
	'ShopCat':[{'pk':'cid','type':'self'}],
	'Feature':[{'pk':'cid','type':'ItemCat'},{'pk':'attr_key','type':'self'}],

	#用户API
	'User':[{'pk':'uid','type':'self'}],
    'UserCredit':[{'pk':'uid','type':'User'},{'pk':'type','type':'User'}],
    'Location':[{'pk':'uid','type':'User'},{'pk':'num_iid','type':'Item'}],

    #店铺API
    'Shop':[{'pk':'sid','type':'self'}],
	'ShopScore':[{'pk':'sid','type':'Shop'}],
	#'SellerCat':[{'pk':'nick','type':'param'}],
	'SellerCat':[{'pk':'cid','type':'self'}],

	#商品API
	'AfterSale':[{'pk':'after_sale_id','type':'self'}],
	'ItemTemplate':[{'pk':'template_id','type':'self'}],
	'Sku':[{'pk':'sku_id','type':'self'}],
	'Item':[{'pk':'num_iid','type':'self'}],
	#'Location':[{'pk':'num_iid','type':'parent'}],
	'ItemImg':[{'pk':'id','type':'self'}],
	'PropImg':[{'pk':'id','type':'self'}],
	'Video':[{'pk':'id','type':'self'}],
	'ItemCategory':[{'pk':'category_id','type':'self'}],
	'Product':[{'pk':'product_id','type':'self'}],
	'ProductImg':[{'pk':'id','type':'self'}],
	'ProductPropImg':[{'pk':'id','type':'self'}],

	#交易API
	'Trade':[{'pk':'tid','type':'self'}],
	'Order':[{'pk':'oid','type':'self'}],
	'PromotionDetail':[{'pk':'id','type':'self'}],
	#'Task':[{'pk':'task_id','type':'self'}],

	#评价API
	'TradeRate':[{'pk':'tid','type':'self'},{'pk':'oid','type':'self'}]

	#关联推荐API

	#旺旺API

	#物流API

	#聚划算API
}


#API中字段类型在mysql中的对应类型
field_type_mapping={
	'Number':'INTEGER',
	'String':'VARCHAR(20)',
	'String[]':'VARCHARchar(200)',
	'Boolean':'BOOLEAN',
	'Boolean []':'VARCHAR(50)',
	'Date':'DATE',
	'Price':'DECIMAL(5,2)',
	'Byte []':'VARCHAR(20)',
}

fields={
	#类目API
	'taobao.itemcats.authorize.get':'brand.vid,brand.name,item_cat.cid,item_cat.name,\
	item_cat.status,item_cat.sort_order,item_cat.parent_cid,item_cat.is_parent',
	#用户API
	'taobao.user.get':'user_id,nick,sex,buyer_credit,seller_credit,location,created,last_visit'
}

